Quarto One

Author

JY

Quarto One

My first real quarto document to check out the system.

Basic setup with more advanced YAML.

Quarto references:

BC Beer Data

Data obtained from BC Liquor Market Review, a quarterly report from BC Liquor Distribution Branch.

Thumbnail image and link to LMR

Fig 1. LMR thumbnail

Callout: Fun fact note

Beer is good! Beer is for everybody!

What’s in the data?

Categories:

category
Domestic - BC Beer
Domestic - Other Province Beer
Import Beer
category subcategory
Domestic - BC Beer Domestic - BC Commercial Beer
Domestic - BC Beer Domestic - BC Micro Brew Beer
Domestic - BC Beer Domestic - BC Regional Beer
Domestic - Other Province Beer Domestic - Other Province Commercial Beer
Domestic - Other Province Beer Domestic - Other Province Micro Brew Beer
Domestic - Other Province Beer Domestic - Other Province Regional Beer
Import Beer Asia And South Pacific Beer
Import Beer Europe Beer
Import Beer Mexico And Caribbean Beer
Import Beer Other Country Beer
Import Beer USA Beer

Date range: 2016-03-01 to 2022-06-30

Stats

Overall View

Totals by Quarter

% Change - Qtr over Qtr

Compare by Same Quarter, Year over Year

More data needed

By Category

Breakdown by Category

Contribution to Change

  • couple of way to show this:

    • absolute value of change by category

    • % of total change that each category makes up (sort of closer to coefficient of determination)

% Change - Qtr over Qtr

Correlation

One-way Anova

Tells us whether there is a difference in the average netsales based on categories or not.

fit <- aov(netsales ~ category, data=beer_data_cat)
summary(fit)
            Df    Sum Sq   Mean Sq F value Pr(>F)    
category     2 4.993e+17 2.497e+17   922.4 <2e-16 ***
Residuals   75 2.030e+16 2.707e+14                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Summary tells us that there is a significant difference in mean values of net sales from one category to another.

Variable Significance

Using TukeyHSD

TukeyHSD(fit)
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = netsales ~ category, data = beer_data_cat)

$category
                                                       diff       lwr       upr
Import Beer-Domestic - Other Province Beer         17955703   7045020  28866386
Domestic - BC Beer-Domestic - Other Province Beer 177990422 167079739 188901105
Domestic - BC Beer-Import Beer                    160034719 149124036 170945402
                                                      p adj
Import Beer-Domestic - Other Province Beer        0.0005354
Domestic - BC Beer-Domestic - Other Province Beer 0.0000000
Domestic - BC Beer-Import Beer                    0.0000000

The output shows the pairwise combinations. If I understand correctly:

  • NO significant difference between net sales for ‘Domestic - Other Province’ and ‘Import’.

  • STRONG significant differences between ‘Domestic - BC Beer’ and ‘Import’ AND between ‘Domestic - BC Beer’ and ‘Domestic - Other Province.’

The conclusion is that ‘Domestic - BC Beer’ has the strongest influence on sales. Which of course is clear from looking at the charts.

Linear Regression

  • Spread the categories into columns

  • Convert qtr into a dummy variable - spread into cols